Skip to content

Make Ctrl+P toggle sent agent messages too - #1281

Merged
sethkarten merged 2 commits into
mainfrom
fix/ctrl-p-sent-message-expansion
Aug 13, 2026
Merged

Make Ctrl+P toggle sent agent messages too#1281
sethkarten merged 2 commits into
mainfrom
fix/ctrl-p-sent-message-expansion

Conversation

@snimu

@snimu snimu commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What this does

Ctrl+P toggles agent-to-agent messages open and closed. Until now it only worked on messages the agent received — messages it sent stayed collapsed (they only opened together with the whole tool output via Ctrl+O). Now Ctrl+P expands and collapses both sent and received messages together.

Why

Sent and received messages are two halves of the same conversation. Having one key expand one half, and a different key (meant for tool output) expand the other, was confusing and inconsistent.

How it works

There was already a single "are agent messages expanded" switch behind Ctrl+P. The sent-message display just wasn't connected to it — it was wired to the tool-output switch instead. The fix connects the sent-message display to the same switch the received messages use, and disconnects it from the tool-output one. So:

  • Ctrl+P opens and closes all agent messages, sent and received.
  • Ctrl+O goes back to meaning tool output only.
  • No new keybinding, no second switch to keep in sync.

Changes

  • The sent-message part of the code cell display now reads the shared message-expansion switch (+32/−1 across four files).
  • Tests covering the new toggle behavior (+47/−1).
  • One changelog entry.

Lines changed: source +32/−1, tests +47/−1, changelog +1/−0.

Checks

  • npm run check clean.
  • 184 tests across the touched areas pass.

Note

Low Risk
Interactive UI rendering and expansion state only; no auth, persistence, or execution behavior changes.

Overview
Ctrl+P (app.messages.expand) now expands and collapses sent agent messages in IPython/agent_message.send tool rows, not only received AgentMessageComponent rows.

Sent-message bodies in IPythonCellComponent were tied to tool output expansion (expanded / Ctrl+O). They now use a separate agentMessagesExpanded flag that follows the same global toggle as received messages. ToolExecutionComponent stores that flag, passes it into nested IPython cells, and InteractiveMode.applyChatExpansion pushes agentMessagesExpanded to chat children (with a small type guard). New and rehydrated tool rows get the current setting at creation time.

Ctrl+O stays for tool/code/output expansion; Ctrl+P controls all agent-to-agent message text (sent and received) together.

Reviewed by Cursor Bugbot for commit 36d6bb6. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix Ctrl+P to toggle sent agent messages in addition to received messages

  • Adds a separate agentMessagesExpanded flag to ToolExecutionComponent and IPythonCellComponent so sent agent messages expand/collapse independently of tool output expansion.
  • InteractiveMode.applyChatExpansion now calls setAgentMessagesExpanded on children that support it, propagating the Ctrl+P toggle to both sent and received agent messages.
  • Newly created tool blocks inherit the current agentMessagesExpanded state at construction time via a new AgentMessagesExpandable interface and hasAgentMessagesExpansion type guard.

Macroscope summarized 36d6bb6.

@sethkarten
sethkarten self-requested a review August 13, 2026 22:19
@sethkarten
sethkarten merged commit f8d73ab into main Aug 13, 2026
17 checks passed
@sethkarten
sethkarten deleted the fix/ctrl-p-sent-message-expansion branch August 13, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants